package cn.tedu.three;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

@Component
public class GuanYu {

    private String name="关云长";
    // 明确依赖关系:声明青龙偃月刀属性
    @Autowired
    @Qualifier("blade1")
    private DragonBlade dragonBlade;

    // 关羽的战斗方法:输出"关云长使用青龙偃月刀战斗"
    public void fight(){

        System.out.println(name+"使用"+dragonBlade.getName()+"战斗");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public DragonBlade getDragonBlade() {
        return dragonBlade;
    }

    public void setDragonBlade(DragonBlade dragonBlade) {
        this.dragonBlade = dragonBlade;
    }
}
